cmake_minimum_required(VERSION 3.22)
project(xnb_CAD LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 解决msvc下 Qt乱码的问题
add_compile_options("/utf-8")
add_definitions(-DUNICODE -D_UNICODE)
# 多处理器编译，加快编译速度
add_compile_options(/MP)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

find_package(Qt5 COMPONENTS
    Core
    Widgets
    Gui
    OpenGL REQUIRED)

find_package(VTK COMPONENTS
        ChartsCore
        CommonDataModel
        FiltersGeneral
        FiltersSources
        FiltersModeling
        GUISupportQt
        RenderingCore
        RenderingOpenGL2
        RenderingFreeType
        RenderingAnnotation
        RenderingContextOpenGL2
        InteractionStyle
        InteractionWidgets REQUIRED
        )
find_package(OpenCASCADE REQUIRED)
include_directories(${OpenCASCADE_INCLUDE_DIR})

add_subdirectory(sample)

add_executable(xnb_CAD main.cpp)
target_link_libraries(
    xnb_CAD
    Qt5::Core Qt5::Widgets Qt5::Gui Qt5::OpenGL
    ${VTK_LIBRARIES}
    ${OpenCASCADE_LIBRARIES}
    )

vtk_module_autoinit(
  TARGETS xnb_CAD
  MODULES ${VTK_LIBRARIES}
)
